// KWServerTreeView.h : interface of the CKWServerTreeView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_KWSERVERTREEVIEW_H__24F272D4_5B86_4923_BE8B_131D3A18B90F__INCLUDED_)
#define AFX_KWSERVERTREEVIEW_H__24F272D4_5B86_4923_BE8B_131D3A18B90F__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WM_APP_UPDATELISTVIEW       (WM_APP+1000)

// Tree view item level
#define TVIL_UNKNOW         0
#define TVIL_ROOT           1
#define TVIL_EVENT          11
#define TVIL_CONNECTION     12
#define TVIL_COALMINELIST   13
#define TVIL_COALMINE       131

class CKWServerDoc;

class CKWServerTreeView : public CTreeView
{
protected: // create from serialization only
	CKWServerTreeView();
	DECLARE_DYNCREATE(CKWServerTreeView)

	// Attributes
public:
	CKWServerDoc* GetDocument();

	// Operations
public:
	void ConnectionStatusChanged(long nCoalMineId);

	// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CKWServerTreeView)
public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
	virtual void OnInitialUpdate(); // called first time after construct
	//}}AFX_VIRTUAL

	// Implementation
public:
	HTREEITEM GetItemByLevel(int nLevel, void * pSomething = NULL);
	int GetItemLevel(HTREEITEM hItem);
	virtual ~CKWServerTreeView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	HTREEITEM GetConnectionItem() const;
	HTREEITEM GetCoalMineListItem() const;
	HTREEITEM GetEventItem() const;
	CImageList * m_pImageList;

	// Generated message map functions
protected:
	//{{AFX_MSG(CKWServerTreeView)
	afx_msg void OnNewCoalMineUnit();
	afx_msg void OnModifyCoalMineUnit();
	afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnDeleteCoalMineUnit();
	afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in KWServerTreeView.cpp
inline CKWServerDoc* CKWServerTreeView::GetDocument()
{ return (CKWServerDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_KWSERVERTREEVIEW_H__24F272D4_5B86_4923_BE8B_131D3A18B90F__INCLUDED_)
